<?php
/*
	 * index.php
	 * Retral/CSCD494 Winter 2009
	 * Eastern Washington University
	 *
	 * File Description:
	 * Set up the page container and framework to load the proper pages. All visible pages should be directed
	 * through this page using $_REQUEST (POST or GET) variable 'page'. All included files should start then with
	 * the prefix "inc-" i.e. inc-login.php. 
	 *
	 * This sets up DB connection constants, as well as session handlers.
	 * 
	 * Other:
	 * - Includes prototype 1,5 and scriptaculous javascript libraries. Note: Prototype 1,6 broke the login page animation
	 * - To do in the future: Move sessions to be completely DB side instead of using cookies
	 */

	@include_once("www-hidden/sessionstart.php");
	
	//First spot reserved for session handling - *MUST* be first thing in this file.
	//Also sets the following defines: 
	/*
		These should be used for all db connections to maintain a single db connection setup, should it change:
		
		ORA_CON_UN - Username for Oracle conn
		ORA_CON_PW - Password for Oracle conn
		ORA_CON_DB - DB connection string for Oracle
	*/

	
	?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
	<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
	<title>EWU Advancement Exam</title>
	<link rel="stylesheet" href="css/main.css" type="text/css" media="screen">
	<script type="text/javascript" src="script/main.js"></script>

	<script src="scriptaculous/lib/prototype.js" type="text/javascript"></script>
	<script src="scriptaculous/src/scriptaculous.js" type="text/javascript"></script>

</head>
<body>
	<?php
	include "utils.php";

	//Determine which page should be loaded
	if (isset($_REQUEST['page']))
		$page_inc = "inc-" . $_REQUEST['page'] . ".php";
	else //Load a home page for appropriate user
	{
		if ($_SESSION['roleCode'] == "student")
			$page_inc = "inc-studentHome.php";
		else if ($_SESSION['roleCode'] == "admin")
			$page_inc = "inc-adminHome.php";
		else if ($_SESSION['roleCode'] == "faculty")
			$page_inc = "inc-faculHome.php";
		else
			$page_inc = "inc-home.php";
	}
	?>
	
	<?php
	if (isset($_REQUEST['min']))
		$min = $_REQUEST['min'];
	else
		$min = 4;
		
	if ($min > 0)
	{
	?>
<!--begin page-->
<!-- Page Centering container: Requires IE7+ -->
<div id="page-container" class="page-container">
	<!-- Top Banner -->
	<div id="banner-top" class="banner-top">&nbsp;</div>

	<?php
	}
	
	if ($min > 1)
	{
	?>
	<!-- Top, Horizontal Nav Bar -->
	<div id="menu-bar" class="menu-bar">
		<?php
			if(file_exists("inc-nav-menu.php"))
				include("inc-nav-menu.php");
			else
				echo "<br><b>Error Loading Navigation.</b>";
		?>
	</div>
	<?php
	}
	?>
	<!-- Body Container -->
	<div id="body-container" class="body-container">
				
				<!-- Main Content Pane -->
				<div id="body-main" class="body-main">
				<?php 
					//If the user just logged out, display message
					if (isset($_GET['logout']))
						echo "<span style=\"color:red;font-weight:bold;font-size:9px;\">You have been logged out</span><br>";
				?>
					<?php
						if (!file_exists($page_inc))
							@include("inc-404.php");
						else
							@include($page_inc);
					?>
				</div> <!-- end main content pane -->
	</div> <!-- end body-container -->
</div> <!--end page container-->
<script type="text/javascript" src="script/closing-main.js"></script>

<div class="copyright-text">Copyright &copy; 2009 Retral</div>
</body>
</html>
